from logging import exception

while True:
    try:
        op = input("请输入一个四则运算算是(例如1+2):")

        # 四则运算
        # 加法
        if '+' in op:
            num = op.split('+')
            result = int(num[0])+int(num[1])
            print(result)
        # 减法
        elif '-' in op:
            num = op.split('-')
            result = int(num[0]) - int(num[1])
            print(result)
        # 乘法
        elif '*' in op:
            num = op.split('*')
            result = int(num[0]) * int(num[1])
            print(result)
        # 除法
        elif '/' in op:
            num = op.split('/')
            result = int(num[0]) / int(num[1])
            print(result)
        # 退出
        elif op == 'C':
            print("感谢您使用本计算器")
            break
        else:
            raise Exception("请按照1+2的格式输入!!")
    except ZeroDivisionError:
        print("注意除法运算，除数不能为0!!")
    except Exception as e:
        print(e)